package com.tunnel.common.util;

/**
 * 内容过滤
 */
public final class ContentFilterUtil {

	private static final String[] HTML_TAGS = {
		"<html","<head","<body","<script",
		"<a","<span","<h","<br","<p",
		"<tr","<td","<div","<title","<link",
		"<h","<meta","src=","href=","onclick=","class=","style="
	};

	public static boolean checkIsHtml(String content){
		//根据关键词出现次数，判断是否很可能是html
		int count = 0;
		content = content.toLowerCase();
		for(String tag:HTML_TAGS){
			if(content.contains(tag)){
				count++;
			}
			if(count>=2){
				break;
			}
		}
		
		return count>=2;//超过三个标签同时出现，就认为是html，有点苛刻
	}
	
}
